// PGLTextPave.h: interface for the CPGLTextPave class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PGLTEXTPAVE_H__3B34D90B_947F_4069_8BAA_B84AC9CCA456__INCLUDED_)
#define AFX_PGLTEXTPAVE_H__3B34D90B_947F_4069_8BAA_B84AC9CCA456__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <pgl/core/PGLPave.h>
#include <pgl/core/PGLText.h>

/*! \brief A text pave

  This object represents a string inside a pave canvas. Mainly, the object behaves like a CPGLPave. 
  You can modify and access the text properties by the methods GetText .

  The color of the background and the borders is controlled by the CPGLPave object, the color of the text is controlled by 
  the text object.

\ingroup PGLTextGroup
*/
class PGLCORE_EXT_CLASS CPGLTextPave : public CPGLPave  
{
PGL_DECLARE_DYNCREATE(CPGLTextPave);
public:
	//! \name Constructors
	//@{
	/*! \brief Default constructor

	\param szString string of pave
	\param textColor text color
	\param paveColor pave color
	\param fillColor solid brush color
	*/
	CPGLTextPave(LPCTSTR szString =_T("A text pave"), 
		const CPGLColor& textColor = CPGLColor::GetClassicColor( CPGLColor::Black), 
		const CPGLColor& paveColor = CPGLColor::GetClassicColor( CPGLColor::Black), 
		const CPGLColor& fillColor = CPGLColor::GetClassicColor( CPGLColor::White) );
	//!  copy constructor
	CPGLTextPave(const CPGLTextPave& t){*this=t;};
	// assignement contructor
	CPGLTextPave& operator=(const CPGLTextPave& t);
	//! Destructor
	virtual ~CPGLTextPave();
	//@}

	//! \name Text methods
	//@{
	//! returns a reference to the text object, const
	const CPGLText& GetText() const						{	return m_text;};
	//! returns a reference to the text object
	CPGLText& GetText()									{	return m_text;};
	//! Sets the string
	void SetString( LPCTSTR szString )					{	m_text.SetString(szString);};
	//! returns the string
	LPCTSTR GetString() const							{	return m_text.GetString();};
	//@}

	//! \name Size computations
	//@{
	/*! \brief Fit the pave to the text

	This method is used internaly to resize the pave to the text dimensions.
	*/
	void FitPaveToText(gfxinterface::CGfxInterface& gfx);
	//@}

	//! \name Virtual plotting override
	//@{
	//! Main plot function
	void PlotGfx(gfxinterface::CGfxInterface& gfx);
	//! returns the extent of the text pave (no extent)
	void GetUnionExtent(gfxinterface::CGfxInterface& gfx, CPGLRectD& rExtent);
	//@}

	//! \name Serialzation and debugging
	//@{
	//! Serialize functions
	void SerializeXML(CPGLArchive& ar);

	#ifdef _DEBUG
		//! MFC Dump
	    virtual void Dump( CDumpContext& dc ) const;
	    //! MFC AssertValid
	    virtual void AssertValid() const;   
	#endif
	//@}

protected:
	//! text object
	CPGLText m_text;
	//! 
};

PGL_DECLARE_SMARTPTR( CPGLTextPave );

#endif // !defined(AFX_PGLTEXTPAVE_H__3B34D90B_947F_4069_8BAA_B84AC9CCA456__INCLUDED_)
